from al_earth.main.plugins import GenericEventLoader, Item
from dateutil import rrule


class EventLoader(GenericEventLoader):
    event_type = "Note"
    def __init__(self,config):
        GenericEventLoader.__init__(self,config)
        #config['date'][dtstart]['recursion'][]
        self.recursion = rrule.rruleset()
        for el in self.config['rruleset']:
            r = rrule.rrule(el['rec'],**el['options'])
            if el['exclude']:
                self.recursion.exrule(r)
            else:
                self.recursion.rrule(r)
        self.message = self.config['message']
    def getItems(self):
        return [Item(self.message,"",self.title,None)]
 
